Make popups come up on the same screen as the combo box. (#133544, Morten
authorMatthias Clasen <maclas@gmx.de>
Sun, 8 Feb 2004 00:42:59 +0000 (00:42 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 8 Feb 2004 00:42:59 +0000 (00:42 +0000)
Sun Feb  8 01:44:06 2004  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups
come up on the same screen as the combo box.  (#133544,
Morten Welinder)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkcombobox.c

index bae8eeb080a89a4110ec27633d377c875f9a79b3..b36aaafdfc5a21b1910595c7afe6e0858576546f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Sun Feb  8 01:44:06 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups 
+       come up on the same screen as the combo box.  (#133544, 
+       Morten Welinder)
+
 Fri Feb  6 23:40:24 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (create_file_list): clean up the
index bae8eeb080a89a4110ec27633d377c875f9a79b3..b36aaafdfc5a21b1910595c7afe6e0858576546f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Feb  8 01:44:06 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups 
+       come up on the same screen as the combo box.  (#133544, 
+       Morten Welinder)
+
 Fri Feb  6 23:40:24 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (create_file_list): clean up the
index bae8eeb080a89a4110ec27633d377c875f9a79b3..b36aaafdfc5a21b1910595c7afe6e0858576546f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Feb  8 01:44:06 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups 
+       come up on the same screen as the combo box.  (#133544, 
+       Morten Welinder)
+
 Fri Feb  6 23:40:24 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (create_file_list): clean up the
index bae8eeb080a89a4110ec27633d377c875f9a79b3..b36aaafdfc5a21b1910595c7afe6e0858576546f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Feb  8 01:44:06 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups 
+       come up on the same screen as the combo box.  (#133544, 
+       Morten Welinder)
+
 Fri Feb  6 23:40:24 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (create_file_list): clean up the
index bae8eeb080a89a4110ec27633d377c875f9a79b3..b36aaafdfc5a21b1910595c7afe6e0858576546f 100644 (file)
@@ -1,3 +1,9 @@
+Sun Feb  8 01:44:06 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkcombobox.c (gtk_combo_box_set_popup_widget): Make popups 
+       come up on the same screen as the combo box.  (#133544, 
+       Morten Welinder)
+
 Fri Feb  6 23:40:24 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (create_file_list): clean up the
index eb1918c40c86bb345405069c8c5c409451c653c6..fabb8b4aff98d0189e08247b1ba3f0974e438b5d 100644 (file)
@@ -631,12 +631,36 @@ gtk_combo_box_menu_hide (GtkWidget *menu,
                                 FALSE);
 }
 
+static void
+gtk_combo_box_detacher (GtkWidget *widget,
+                       GtkMenu   *menu)
+{
+  GtkComboBox *combo_box;
+
+  g_return_if_fail (GTK_IS_COMBO_BOX (widget));
+
+  combo_box = GTK_COMBO_BOX (widget);
+  g_return_if_fail (combo_box->priv->popup_widget == (GtkWidget*) menu);
+
+  g_signal_handlers_disconnect_by_func (menu,
+                                       gtk_combo_box_menu_show,
+                                       combo_box);
+  g_signal_handlers_disconnect_by_func (menu,
+                                       gtk_combo_box_menu_hide,
+                                       combo_box);
+  
+  combo_box->priv->popup_widget = NULL;
+}
+
 static void
 gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
                                 GtkWidget   *popup)
 {
   if (GTK_IS_MENU (combo_box->priv->popup_widget))
-    combo_box->priv->popup_widget = NULL;
+    {
+      gtk_menu_detach (GTK_MENU (combo_box->priv->popup_widget));
+      combo_box->priv->popup_widget = NULL;
+    }
   else if (combo_box->priv->popup_widget)
     {
       gtk_container_remove (GTK_CONTAINER (combo_box->priv->popup_frame),
@@ -660,14 +684,18 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
       g_signal_connect (popup, "hide",
                         G_CALLBACK (gtk_combo_box_menu_hide), combo_box);
 
-      /* FIXME: need to attach to widget? */
+      gtk_menu_attach_to_widget (GTK_MENU (popup),
+                                GTK_WIDGET (combo_box),
+                                gtk_combo_box_detacher);
     }
   else
     {
       if (!combo_box->priv->popup_window)
         {
           combo_box->priv->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
-
+         gtk_window_set_screen (combo_box->priv->popup_window, 
+                                gtk_widget_get_screen (combo_box));
+         
           combo_box->priv->popup_frame = gtk_frame_new (NULL);
           gtk_frame_set_shadow_type (GTK_FRAME (combo_box->priv->popup_frame),
                                      GTK_SHADOW_NONE);